package top.banner.es;

import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.indices.CreateIndexRequest;
import org.elasticsearch.client.indices.CreateIndexResponse;

import java.io.IOException;

/**
 * @author XGL
 */
public class IndexCreate {



    public static void main(String[] args) throws IOException {
        final RestHighLevelClient client = ESClient.init();

        //创建索引
        final CreateIndexRequest request = new CreateIndexRequest("user5");
        final CreateIndexResponse response = client.indices().create(request, RequestOptions.DEFAULT);

        //响应状态
        final boolean acknowledged = response.isAcknowledged();

        System.out.println("索引操作：" + acknowledged);
        client.close();
    }
}
